using System.ComponentModel.DataAnnotations;

namespace MudWebApp.Requests;

public class RegisterData
{
    [Required] [MaxLength(20)] public string Name { get; set; } = string.Empty;

    [Required, EmailAddress, DataType(DataType.EmailAddress)]
    public string Email { get; set; } = string.Empty;

    [Required, DataType(DataType.Password)]
    [StringLength(30, ErrorMessage = "密码长度要在 8-30 之间", MinimumLength = 8)]
    [RegularExpression(@"^(?=.*[a-zA-Z])(?=.*\d)(?=.*[^a-zA-Z\d]).+$",
        ErrorMessage = "密码必须包含字母、数字和特殊字符")]
    public string Password { get; set; } = string.Empty;

    [Required, DataType(DataType.Password), Compare("Password", ErrorMessage = "密码不一致")]
    public string ConfirmPassword { get; set; } = string.Empty;
}